package org.shoukaiseki.supersaiyan.db.inittable.system;

import org.shoukaiseki.inittable.domain.TableColumnInfo;
import org.shoukaiseki.inittable.domain.TableIndexInfo;
import org.shoukaiseki.inittable.service.ITableBuildInfoService;
import org.shoukaiseki.kakaroto.annotation.TableBuild;

import java.util.List;

import static org.shoukaiseki.inittable.utils.SksColumnCamelCaseCommon.*;
import static org.shoukaiseki.inittable.utils.TableColumnInfoBuilder.column;
import static org.shoukaiseki.inittable.utils.TableIndexInfoBuilder.uniqueIndex;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableColumns;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableIndexs;

/**
 * OK
 * org.shoukaiseki.supersaiyan.db.inittable.system.SysMenuInitTable
 * <br>
 *
 * @author shoukaiseki blog http://www.shoukaiseki.top/<br> E-mail jiang28555@Gmail.com<br>
 * @date 2022-10-15 13:45:13<br>
 */
@TableBuild(name = SysMenuInitTable.TABLE_NAME, comment = "菜单权限表",version = 1)
public class SysMenuInitTable implements ITableBuildInfoService {

    public static final String TABLE_NAME="sys_menu";

    public static final String COLUMN_MENU_ID="menu_id";

    @Override
    public List<TableColumnInfo> tableColumnInfoList(){
        List<TableColumnInfo> table = tableColumns(
                uniqueId(COLUMN_MENU_ID,"菜单ID"),
                column("	menu_name   varchar(50)              not null comment '菜单名称',"),
                column("	parent_id   bigint       default 0   null comment '父菜单ID',"),
                column("	order_num   int          default 0   null comment '显示顺序',"),
                column("	path        varchar(200) default ''  null comment '路由地址',"),
                column("	component   varchar(255)             null comment '组件路径',"),
                column("	component_name   varchar(100)   default ''   not null comment '前端组建名',")
                        .description("用于禁用缓存"),
                column("	query       varchar(255)             null comment '路由参数',"),
                column("	is_frame    int          default 1   null comment '是否为外链（0是 1否）',"),
                column("	is_cache    int          default 0   null comment '是否缓存（0缓存 1不缓存）',"),
                column("	menu_type   char         default ''  null comment '菜单类型（M目录 C菜单 F按钮）',"),
                column("	visible     char         default '0' null comment '菜单状态（0显示 1隐藏）',"),
                column("	status      char         default '0' null comment '菜单状态（0正常 1停用）',"),


                column("	visible_flag   int(12) unsigned  default 0xffff not null comment '可见标识',")
                        .description("不为 0xffffffff 则不会显示")
                        .remark(""
                                + "&2: 没有相应模块(未使用)"
                                +"&0x200 系统配置隐藏(java中判断 sysConfigNameControlVisible 系统配置为启用时清零)"
                        ),

                column("  hide_flag    int(12) unsigned DEFAULT '0' not null COMMENT '隐藏标识',")
                        .description("如果 >0 则不会显示")
                        .remark(""
                                +"&0x200 系统配置显示(java中判断 sysConfigNameControlHide 系统配置启用时置位)"
                        ),

//                column("	sysConfigVisibleFlag   int(12) default '0'  not null comment '显示',")
//                        .description("关联系统配置,controlVisibleSysConfigName 对应的配置启用后,将显示该菜单"),
//                column("	sysConfigHideFlag      int(12) default '0'  not null comment '隐藏',")
//                        .description("关联系统配置,controlHideSysConfigName 对应的配置启用后,将隐藏该菜单")
//                        .remark("(暂未使用)"),

                column("	sys_config_name_control_visible   varchar(256) default ''  not null comment '系统配置控制显示',")
                        .description("如果不为空,则启用该系统配置后才拥有该权限"),

                column("	sys_config_name_control_hide     varchar(256) default ''  not null comment '系统配置控制隐藏',")
                        .description("关联系统配置,如果系统配置(暂未使用)")
                        .remark("(暂未使用)"),

                column("	manage_mode  char         default '0' not null comment '管理模式',")
                        .description("1: 仅管理模式下可见"),

                column("	module_name  varchar(256) default ''  not null comment '模块名称',")
                        .description("引入该模块后才有效"),

                column("	perms       varchar(100)             null comment '权限标识',"),
                column("	icon        varchar(100) default '#' null comment '菜单图标',"),
                column("	remark      varchar(500) default ''  null comment '备注'"),

                siteId(),
                orgId(),
                deptId(),
                createUserId(),
                createTime(),
                updateUserId(),
                updateTime(),
                delFlag(),

                null
        );

        return table;
    }

}
